package dto

import (
	"gitee.com/xiedongji/go-core/validator"
	"github.com/gin-gonic/gin"
)

//一般用户输入的数据 都需要 验证
type UserRegInput struct {
	UserName string `json:"username" form:"username" comment:"姓名" example:"admin" validate:"required,is_valid_username"`
	Password string `json:"password" form:"password" comment:"密码" example:"123456" validate:"required,min=6"`
}

func (params *UserRegInput) BindValidParams(ctx *gin.Context) error {
	return validator.ParseParamsAndValidate(ctx, params)
}

//一般用户输入的数据 都需要 验证
type UserLoginInput struct {
	UserName string `json:"username" form:"username" comment:"姓名" example:"admin" validate:"required,is_valid_username"`
	Password string `json:"password" form:"password" comment:"密码" example:"123456" validate:"required"`
}

func (params *UserLoginInput) BindValidParams(ctx *gin.Context) error {
	return validator.ParseParamsAndValidate(ctx, params)
}

type UserLoginOutput struct {
	Nickname string `json:"nickname"`
	Username string `json:"username"`
	Token string `json:"token"`
}
